package com.chench.interview.threadpool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author--chench2021
 * @date --2024-07-05-11:25
 * @desc --
 */
public class TheadPoolTest {
    public static void main(String[] args) {
        ThreadPoolExecutor theadPoolExecute = new ThreadPoolExecutor(
                4,
                8,
                60,
                 TimeUnit.SECONDS,
                 new ArrayBlockingQueue<>(1024),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.CallerRunsPolicy()
        );
        theadPoolExecute.prestartCoreThread();
        theadPoolExecute.prestartAllCoreThreads();
        theadPoolExecute.allowCoreThreadTimeOut(true);
        theadPoolExecute.execute(() -> {

        });
    }
}
